/**
 * 晚间工作状态
 * @author liaosh
 * @date 2022-10-18 22:52
 */
public class EveningState implements State {

    @Override
    public void writeProgram(Work work) {
        if (work.getWorkFinish()) {
            work.setCurrentWorkState(new RestState());
            work.writeProgram();
        } else {
            // 工作未完成，加班处理
            if (work.getCurrentHour() < 21) {
                System.out.println("当前时间：" + work.getCurrentHour() + "点，加班处理，非常疲惫");
            } else {
                // 超过 21 点，转入休息状态
                work.setCurrentWorkState(new SleepState());
                work.writeProgram();
            }
        }
    }
}
